package com.dingup.homework.dao;

import com.alibaba.fastjson.JSONArray;
import com.dingup.homework.bean.DO.HwSsatWordRecordDO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

import static com.dingup.homework.util.ConstUtil.*;

/**
 * @author jun 2018/11/12.
 */
public interface HwSsatWordRecordMapper {
    /**
     * 添加记录
     *
     * @param hwSsatWordRecordDO HwSsatWordRecordDO
     * @return Boolean
     */
    Boolean add(HwSsatWordRecordDO hwSsatWordRecordDO);

    /**
     * 更新答案
     *
     * @param id         Integer
     * @param statResult String
     * @param correctNum Integer
     * @param totalNum   Integer
     * @param answerData JSONArray
     * @return Boolean
     */
    Boolean updateAnswerData(@Param(KEY_ID) Integer id,
                             @Param(KEY_STAT_RESULT) String statResult,
                             @Param(KEY_CORRECT_NUM) Integer correctNum,
                             @Param(KEY_TOTAL_NUM) Integer totalNum,
                             @Param(KEY_ANSWER_DATA) JSONArray answerData);

    /**
     * 根据作业信息获取数据
     *
     * @param userId              String
     * @param homeworkRecordId    Integer
     * @param homeworkQuestionNum Integer
     * @return HwSsatWordRecordDO
     */
    HwSsatWordRecordDO getByHomeworkInfo(@Param(KEY_USER_ID) String userId,
                                         @Param(KEY_HOMEWORK_RECORD_ID) Integer homeworkRecordId,
                                         @Param(KEY_HOMEWORK_QUESTION_NUM) Integer homeworkQuestionNum);

    /**
     * 根据作业记录id获取数据列表
     *
     * @param homeworkRecordId Integer
     * @return List<HwSsatWordRecordDO>
     */
    List<HwSsatWordRecordDO> listByHomeworkRecordId(Integer homeworkRecordId);
}
